package com.ronghuanet.org.domain;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.ronghuanet.basic.domain.BaseDomain;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 *
 */
@Data
@ApiModel(value = "部门域对象")
public class Department extends BaseDomain {
    @ApiModelProperty(value = "名称")
    private String name;
    @ApiModelProperty(value = "简介")
    private String intro;
    @ApiModelProperty(value = "创建时间")
    private Date create_time;
    @ApiModelProperty(value = "更新时间")
    private Date update_time;
    private  String path; //路径
    private Integer state = 1; //状态
    //部门经理
    private Employee manager;
    //上级部门
    private Department parent;
    //子级部门
    private List<Department> children = new ArrayList<>();

    @JsonFormat(pattern = "yyyy-MM-dd hh:mm:ss",timezone = "GMT+8")
    public Date getCreate_time() {
        return create_time;
    }

    @DateTimeFormat(pattern = "yyyy-MM-dd hh:mm:ss")
    public void setCreate_time(Date create_time) {
        this.create_time = create_time;
    }
    @JsonFormat(pattern = "yyyy-MM-dd hh:mm:ss",timezone = "GMT+8")
    public Date getUpdate_time() {
        return update_time;
    }
    @DateTimeFormat(pattern = "yyyy-MM-dd hh:mm:ss")
    public void setUpdate_time(Date update_time) {
        this.update_time = update_time;
    }

    @Override
    public String toString() {
        return "Department{" +
                "id=" + this.getId() +
                ", name='" + name + '\'' +
                ", intro='" + intro + '\'' +
                ", create_time=" + create_time +
                ", update_time=" + update_time +
                '}';
    }
}
